
package sumo.box;

// eu acho que ta zuando as propriedades quando submete pro repositorio... mudem ai
//as propriedades do projeto na aba RUN coloquem:
//-Djava.library.path="C:\Program Files (x86)\Java\jdk1.7.0\jre\lib\ext"
//coloquem o caminho certo do lib\ext no pc de vcs.





import java.io.IOException;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Sound;
import org.newdawn.slick.state.StateBasedGame;




 
public class Box extends StateBasedGame{

    public static final int MENUSTATE = 201;
    public static final int MENUJOGOSTATE = 202;
    public static final int SCORESSTATE = 203;
    public static final int LEVELSELECTSTATE = 204;
    public static final int LEVEL1STATE = 0;
    public static final int LEVEL2STATE = 1;
    public static final int LEVEL3STATE = 2;
    public static final int LEVEL4STATE = 3;
    public static final int LEVEL5STATE = 4;
    public static final int LEVEL6STATE = 5;
    
    
    

    
    private static int faseAtual = 0;
    private static Sound toq = null;
    private static Sound arrasto = null;
    private static Sound placed = null;
    private static Sound bomb = null;
    private static Sound fundo = null;
    private static Sound passo = null;
    private static Sound foguete = null;
    private static Sound sheep = null;
    
    private static Image parabens = null;
    
    private static boolean musicOn = false;
    private static boolean soundOn = true;
    
    public Box() throws SlickException
    {
        super("BombQuest");
        this.addState(new Menu(MENUSTATE));
        this.addState(new Level1(LEVEL1STATE));
        this.addState(new MenuJogo(MENUJOGOSTATE));
        this.addState(new TelaScores(SCORESSTATE));
        this.addState(new Level2(LEVEL2STATE));
        this.addState(new LevelSelect(LEVELSELECTSTATE));
        this.addState(new Level3(LEVEL3STATE));
        this.addState(new Level4(LEVEL4STATE));
        this.addState(new Level5(LEVEL5STATE));
        this.addState(new Level6(LEVEL6STATE));
        this.enterState(MENUSTATE);
        
        toq = new Sound("src/SOUNDS/toc00.wav");
        arrasto = new Sound("src/SOUNDS/drag00.wav");
        placed = new Sound("src/SOUNDS/click00.wav");
        fundo = new Sound("src/SOUNDS/overworld00.wav");
        bomb = new Sound("src/SOUNDS/bomb00.wav");
        passo = new Sound("src/SOUNDS/step00.wav");
        foguete = new Sound("src/SOUNDS/foguete.wav");
        sheep = new Sound("src/SOUNDS/sheep.wav");
        
        
    }
 


    @Override
    public void initStatesList(GameContainer gc) throws SlickException {
        this.getState(MENUSTATE).init(gc, this);
        this.getState(MENUJOGOSTATE).init(gc, this);
        this.getState(LEVEL1STATE).init(gc, this);
        this.getState(SCORESSTATE).init(gc, this);
        this.getState(LEVEL2STATE).init(gc, this);
        this.getState(LEVELSELECTSTATE).init(gc, this);
        this.getState(LEVEL3STATE).init(gc, this);
        this.getState(LEVEL4STATE).init(gc, this);
        this.getState(LEVEL5STATE).init(gc, this);
        this.getState(LEVEL6STATE).init(gc, this);
        
        
        parabens = new Image("src/IMAGES/complete.png");
        
    }
    
    public static void main(String[] args) throws SlickException, IOException {
        AppGameContainer app = new AppGameContainer(new Box());
        app.setDisplayMode(400, 400, false);
        //carregar os scores
        Arquivo.carregar();
        app.setShowFPS(false);
        music();
        app.start();
        
         
    }
    
    public static void music(){
        if(!musicOn){
            fundo.loop();
            musicOn = true;
        } 
        else {
            
            fundo.stop();
            musicOn = false;
        }
    }
    public static  boolean isMusic(){
        return musicOn;
    }
    public static void setFaseAtual(int state){
        faseAtual = state;
    }
    public static int getFaseAtual(){
        return  faseAtual;
    }
    public static void sound(){
        if(!soundOn){
            soundOn = true;
        } 
        else {
            soundOn = false;
        }
    }
    public static boolean isSound(){
        return soundOn;
    }
    public static void clickSound(){
        if(soundOn){
            toq.play();
        }
    }
    public static void arrastoSound(){
        if(soundOn){
            arrasto.play();
        }
    }
    public static void placedSound(){
        if(soundOn){
            placed.play();
        }
    }
    public static void completeSound(){
        if(soundOn){
            bomb.play();
        }
    }
    public static void completeSoundInterrupt(){
        if(soundOn){
            bomb.stop();
        }
    }
    public static void sheepSound(){
        if(soundOn){
            sheep.play();
        }
    }
    public static void passoSound(){
        if(soundOn){
            passo.play();
        }
    }
    public static void fogueteSound(){
        if(soundOn){
            foguete.play();
        }
    }
    public static Image getParabens(){
        return parabens;
}
}